package com.jxc.model.po;

/***********************************************************************
 * Module:  Damagelist.java
 * Author:  Administrator
 * Purpose: Defines the Class Damagelist
 ***********************************************************************/

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * 报损单
 * 
 * @pdOid 736c11f4-90b4-48db-b302-f61a99986733
 */
@Entity
@Table(name = "KCGL_DAMAGELIST")
public class Damagelist extends IdEntity implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 799377636781244167L;
	/**
	 * 日期
	 * 
	 * @pdOid 7be14c86-51aa-4da3-b861-5e26ba2a9cad
	 */
	private Date date;
	/**
	 * 单号
	 * 
	 * @pdOid 4edd0834-ade9-4b0a-98d1-1b4567e90296
	 */
	private String serial;
	/**
	 * 营业员
	 * 
	 * @pdOid 0fa36e3a-0d01-4a51-9067-feef4f4a923c
	 */
	private User user;
	/**
	 * 仓库
	 * 
	 * @pdOid 79858b0d-a49f-46d0-9947-959e4409adc9
	 */
	private Repertory repertory;
	/**
	 * 报损总额
	 * 
	 * @pdOid c336b053-b66c-4377-89ec-5711583642dc
	 */
	private Double total;
	/**
	 * 报损总量
	 */
	private Integer num;
	/**
	 * 是否确认
	 * 
	 */
	private Boolean isConfirm;
	/**
	 * 确认时间
	 * 
	 */
	private Date confirmDate;
	/**
	 * 确认人
	 * 
	 */
	private User confirmUser;
	/**
	 * 备注
	 * 
	 * @pdOid 601643dd-9fe0-433c-9ab5-85673c8cd255
	 */
	private String remark;
	/**
	 * 报损明细
	 */
	private List<DamagelistItem> items = new ArrayList<DamagelistItem>();

	public Damagelist() {
		super();
	}

	public Damagelist(Long id) {
		super(id);
	}

	@Column(name = "IS_CONFIRM")
	public Boolean getIsConfirm() {
		return isConfirm;
	}

	public void setIsConfirm(Boolean isConfirm) {
		this.isConfirm = isConfirm;
	}

	@Column(name = "CONFIRM_DATE")
	public Date getConfirmDate() {
		return confirmDate;
	}

	public void setConfirmDate(Date confirmDate) {
		this.confirmDate = confirmDate;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CONFIRM_USER_ID")
	public User getConfirmUser() {
		return confirmUser;
	}

	public void setConfirmUser(User confirmUser) {
		this.confirmUser = confirmUser;
	}

	@Column(name = "DATE")
	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	@Column(name = "SERIAL")
	public String getSerial() {
		return serial;
	}

	public void setSerial(String serial) {
		this.serial = serial;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "USER_ID")
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "REPERTORY_ID")
	public Repertory getRepertory() {
		return repertory;
	}

	public void setRepertory(Repertory repertory) {
		this.repertory = repertory;
	}

	@Column(name = "TOTAL", length = 10, precision = 2)
	public Double getTotal() {
		return total;
	}

	public void setTotal(Double total) {
		this.total = total;
	}

	@Column(name = "REMARK")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@OneToMany(cascade = CascadeType.REMOVE, fetch = FetchType.LAZY, mappedBy = "damagelist", orphanRemoval = true)
	public List<DamagelistItem> getItems() {
		return items;
	}

	public void setItems(List<DamagelistItem> items) {
		this.items = items;
	}

	@Column(name = "NUM")
	public Integer getNum() {
		return num;
	}

	public void setNum(Integer num) {
		this.num = num;
	}

}